home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_065 / prep / demo.p < prev    next >
Text File  |  1992-05-06  |  3KB  |  114 lines

  1. c Demo code segment to illustrate some PREP facilities.  This is
  2. c just a preprocessor demo and will not compile without adding
  3. c a lot of variable declarations.
  4.  
  5.  
  6. #include "premac.h"
  7.  
  8. c flag to call alternate window filler if window size = array size
  9. : PIXIE_FLAG    (((xpix1-xpix0+1) == nrows) & ((ypix1-ypix0+1) == ncols))) ;
  10.  
  11.       include 'tencomn'
  12.  
  13. c open the input data file and initialize the device
  14.       call init
  15.  
  16. c skip over skip0 data sets
  17.       call skipdat( skip0 )
  18.       if (eoflag) call exodus
  19.  
  20. c enter the menu
  21.       call menu
  22.  
  23. c read data tables from the input file and plot until empty
  24.       begin
  25.          
  26. c clear the record numbers
  27.          do j = 1, 10
  28.             record( j ) = 0
  29.          end_do
  30.  
  31.          do j = 1, 10
  32.  
  33.             icount = j
  34.             call getdat
  35.             record( icount ) = first_record
  36.             leave_do (eoflag)
  37.  
  38. c on first dataset of a group reset background
  39.             if ( icount .eq. 1 ) then
  40.                call vsbcol(dev, backcol)
  41.                call vclrwk(dev)
  42.             end if
  43.  
  44. c weed the data to make it fit in the window
  45.             call compact
  46.  
  47. c clear a window and label it
  48.             call windower
  49.  
  50. c Plot the data table , 1st arg is absolute first dim of buffer
  51.             if ( PIXIE_FLAG ) then
  52.                call pixie( HARD_X_DIM, nrows, ncols,
  53.      *                     xpix0, PHYS_HEIGHT - 1 - ypix1,
  54.      *                     buffer )
  55.             else
  56.                call winfill( HARD_X_DIM, nrows, ncols,
  57.      *                       xpix0, xpix1,
  58.      *                       PHYS_HEIGHT - 1 - ypix1,
  59.      *                       PHYS_HEIGHT - 1 - ypix0,
  60.      *                       buffer )
  61.             end if
  62.  
  63. c see if the user is tired and wants to quit
  64.             status = vsmstr( dev, ten, zero, echoxy, dummy)
  65.             if ( status .gt. 0 ) then
  66.                case [ upper( dummy(1:1) ) ]
  67.                   of ( 'Q' )   call exodus
  68.                   of ( 'R' )   leave_do
  69.                   of ( 'B' )   leave_do
  70.                end_case
  71.             end if
  72.  
  73.          end_do
  74.  
  75. c skip over skip data sets
  76.          call skipdat( skip )
  77.  
  78. c Delay and wait for keystroke.  Quit on Q,q; continue on cr; enlarge
  79. c on keys 1,2,3,...9,0 (0 --> 10); make a dump file on D, d.
  80. c If in movie mode, skip this input section, make a dump, and continue
  81.          if ( movie_mode ) then
  82.             if (eoflag) call exodus
  83.             call dump
  84.  
  85.          else
  86. c stay in this loop if end of file has been reached.
  87.             begin
  88.  
  89.                case ( last_key )
  90.                last_key = key(dev)
  91.  
  92.                   of ( 'D' )   call dump
  93.                                continue_case
  94.                   of ( 'Q' )   call exodus
  95.                   of ( 'R' )   call restart
  96.                   of ( 'B' )   call pop( recn )
  97.                                recn = max0( recn, 1 )
  98.                                eoflag = .false.
  99.                   default      call push( max0( record(1), 1 ) )
  100.  
  101.                                call enlarger
  102.                end_case
  103.  
  104.             while ( eoflag )
  105.             again
  106.  
  107.          end if
  108.  
  109.       again
  110.  
  111. c Restore the video mode and turn off the device
  112.       call exodus
  113.       end
  114.